Description
The Current
property of the GameObjectSystem<T>
class provides a static reference to the current instance of the system of type T
. This property is a convenient way to access the system without needing to explicitly retrieve it from a Scene
object using the Get
method. It acts as a syntax sugar, simplifying the access pattern for game object systems.
Usage
Use the Current
property to access the current instance of a game object system of type T
. This is particularly useful when you need to interact with the system frequently and want to avoid repeatedly calling Scene.GetSystem<T>()
.
Ensure that the system has been initialized in the scene before accessing it through Current
to avoid null reference exceptions.
Example
// Example of accessing a game object system using the Current property
// Assuming MyGameObjectSystem is a type of GameObjectSystem
var mySystem = MyGameObjectSystem.Current;
// Use mySystem to perform operations
mySystem.DoSomething();